import Login from './views/Login.vue'
import admin from './views/admin.vue'
import query from './views/query.vue'
import detail from './views/detail.vue'
import scanner from './views/scanner.vue'
import qrCode from './views/qrCode.vue'
import NotFound from './views/404.vue'
import charts from './views/charts.vue'
import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

export default new Router({
  routes: [
    {path:"/",redirect:"/login"},
    {
      path: '/404',
      component: NotFound,
      name: '',
      hidden: true
    },
    {
      path: '*',
      hidden: true,
      redirect: { path: '/404' }
  },
    {
      path: '/login',
      component: Login,
      name: '',
      hidden: true
    },
    {
      path: '/admin',
      component: admin,
      name: 'admin',
      hidden: true,
      children: [
        { 
          path: "query",
          component: query,
          meta: {
            requiresAuth: true
          }
        },
        {
          path: "detail/:username",
          component: detail,
          meta: {
            requiresAuth: true
          }
        },
        {
          path: "charts",
          component: charts,
          meta: {
            requiresAuth: true
          }
        }
      ]
    },
    {
      path: '/scanner',
      component: scanner,
      name: '',
      hidden: true,
      children:[
        {
          path: "qrCode",
          component: qrCode,
          meta: {
            requiresAuth: true
          }
        }
      ]
    },
  ]
})
